//
//  IapTransactionObserver.h
//  iap_pay
//
//  Created by 胡锦涛 on 2020/2/3.
//

#import <Foundation/Foundation.h>
#import <StoreKit/StoreKit.h>

NS_ASSUME_NONNULL_BEGIN
@protocol IapTransactionObserverDelegate;
@interface IapTransactionObserver : NSObject<SKPaymentTransactionObserver>
@property (strong, nonatomic, readonly) SKPayment *payment;
@property (strong, nonatomic, readonly) SKProduct *product;
@property (weak, nonatomic) id<IapTransactionObserverDelegate> delegate;

+ (instancetype)sharedObserver;
+ (void)startObserving;

@end

@protocol IapTransactionObserverDelegate <NSObject>

@required
- (BOOL)shouldAddStorePayment:(SKPayment *)payment forProduct:(SKProduct *)product;

@end

NS_ASSUME_NONNULL_END
